package com.heima.behavior.controller.v1;

import com.heima.behavior.service.BehaviorService;
import com.heima.model.behavior.dtos.CollectionBehaviorDto;
import com.heima.model.behavior.dtos.LikesBehaviorDto;
import com.heima.model.behavior.dtos.ReadDto;
import com.heima.model.behavior.dtos.UnLikesBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1")
public class BehaviorController {

    @Autowired
    private BehaviorService behaviorService;

    /**
     * 点赞
     * @param likesBehaviorDto
     * @return
     */
    @PostMapping("likes_behavior")
    public ResponseResult likesBehavior(@RequestBody LikesBehaviorDto likesBehaviorDto){
        return behaviorService.likesBehavior(likesBehaviorDto);
    }

    /**
     * 阅读
     * @param readDto
     * @return
     */
    @PostMapping("read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadDto readDto){
        return behaviorService.readBehavior(readDto);
    }

    /**
     * 不喜欢 /取消不喜欢
     * @return
     */
    @PostMapping("un_likes_behavior")
    public ResponseResult unLikesBehavior(@RequestBody UnLikesBehaviorDto unLikesBehaviorDto){
        return behaviorService.unLikesBehavior(unLikesBehaviorDto);
    }

}
